/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set sw=2 :miv */
/*
//
// BEGIN SONGBIRD GPL
//
// This file is part of the Songbird web player.
//
// Copyright(c) 2005-2008 POTI, Inc.
// http://songbirdnest.com
//
// This file may be licensed under the terms of of the
// GNU General Public License Version 2 (the "GPL").
//
// Software distributed under the License is distributed
// on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
// express or implied. See the GPL for the specific language
// governing rights and limitations.
//
// You should have received a copy of the GPL along with this
// program. If not, go to http://www.gnu.org/licenses/gpl.html
// or write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
// END SONGBIRD GPL
//
*/

#ifndef __SB_ALBUMSERVICE_H__
#define __SB_ALBUMSERVICE_H__

//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//
// Songbird album service.
//
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------

/**
 * \file  sbAlbumService.h
 * \brief Songbird Album Service Definitions.
 */

//------------------------------------------------------------------------------
//
// Songbird album sorting service.
//
//------------------------------------------------------------------------------

#include "sbAlbumViewCommon.h"

// Songbird imports.
#include <sbIAlbumService.h>
#include <sbIMediaList.h>
#include <sbIMediaListListener.h>
#include <sbLibraryUtils.h>

// Mozilla imports.
#include <nsCOMArray.h>
#include <nsCOMPtr.h>
#include <nsIObserver.h>
#include <nsIObserverService.h>
#include <nsITimer.h>

//------------------------------------------------------------------------------
//
// Songbird album service defs.
//
//------------------------------------------------------------------------------

//
// Songbird album service component defs.
//

#define SB_ALBUMSERVICE_CLASSNAME "sbAlbumService"
#define SB_ALBUMSERVICE_CID                                                   \
  /* {a348caa8-9db2-4b43-8e5d-f437f76731b7} */                                 \
{                                                                              \
    0xa348caa8,                                                                \
    0x9db2,                                                                    \
    0x4b43,                                                                    \
    { 0x8e, 0x5d, 0xf4, 0x37, 0xf7, 0x67, 0x31, 0xb7 }                         \
}


//------------------------------------------------------------------------------
//
// Songbird album service class.
//
//------------------------------------------------------------------------------

class sbAlbumService : public sbIAlbumService,
                       public sbIMediaListListener,
                       public nsIObserver
{
public:
  NS_DECL_ISUPPORTS
  NS_DECL_SBIALBUMSERVICE
  NS_DECL_SBIMEDIALISTLISTENER
  NS_DECL_NSIOBSERVER

  sbAlbumService();
  virtual ~sbAlbumService();

  nsresult Initialize();

private:
  nsCOMPtr<nsIObserverService>  mObserverService;

  nsCOMPtr<sbIMediaList>        mMainLibraryList;
  sbLibraryBatchHelper          mBatchHelper;
  PRBool                        mNeedsRescan;
  nsCOMPtr<nsITimer>            mRescanTimer;
  PRBool                        mInitialized;
  PRBool                        mPrefsAvailable;

  nsresult InitializeLibraryWatch();

  void Finalize();
};

#endif // __SB_ALBUMSERVICE_H__
